package com.example.justbuy.action.admin;

import com.example.justbuy.service.ImageMapperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/admin/")
public class AdminOrderAction {

    @Autowired
    ImageMapperService imageMapperService;

    @RequestMapping("selectorder.htm")
    public String selectorder(){
        return "admin/selectorder.html";
    }
    @RequestMapping("select.htm")
    public String select(Model model,String select){
        Map map=new HashMap();
        System.out.println(select);
        map.put("select",select);
        List<HashMap> list=imageMapperService.getOrderformByOrderformid(map);
        if(list.size()<1||list==null){
            list=imageMapperService.getOrderformByPhone(map);
        }
        System.out.println(list.size());
        model.addAttribute("list",list);
        return "admin/selectorder.html";
    }
}
